/**
 * 频道相关请求模块
 */

import request from "../utils/request";

// 获取所有频道列表
const getAllChannels = function() {
    return request( {
        method: 'GET',
        url: '/v1_0/channels'
    })
}

// 添加频道
const addChannel = (channel) => {
    return request({
        method: 'PATCH', //PATCH:只将修改的数据推送到后端，PUT:将所有数据都推送到后端
        url: '/v1_0/user/channels',
        data: {
            channels: [channel]
        }
    })
}

// 删除频道
const deleteChannel = (channelId) => {
    return request({
        method: 'DELETE',
        url: `/v1_0/user/channels/${channelId}`
    })
}

export {getAllChannels, addChannel, deleteChannel}